package com.fjwt.gz.proxy.ctrl.ifcode;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fjwt.gz.core.model.ApiRes;
import com.fjwt.gz.db.dto.PayAuthDTO;
import com.fjwt.gz.db.vo.PayAuthVO;
import com.fjwt.gz.proxy.ctrl.CommonCtrl;
import com.fjwt.gz.service.impl.PayAuthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通道配置
 * @Author: Will
 * @Date: 2024-01-25
 * @Version: 1.0
 */
@RestController
@Slf4j
@RequestMapping("/api/ifCode")
public class IfCodeController extends CommonCtrl {

    @Autowired
    private PayAuthService payAuthService;

    /**
     * 查询三方出资列表
     * @return
     */
    @GetMapping
    public ApiRes list() {
        PayAuthDTO payAuthDTO = getObject(PayAuthDTO.class);
        log.info("机构端查询三方出资列表，请求地址：/api/ifCode，请求参数：{}", JSONUtil.toJsonStr(payAuthDTO));
        IPage<PayAuthVO> page = payAuthService.selectPageList(getIPage(true), payAuthDTO);
        log.info("机构端查询三方出资列表，请求地址：/api/ifCode，响应结果：{}",  JSONUtil.toJsonStr(page));
        return ApiRes.page(page);
    }

}
